// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const contentLb = sequelizeClient.define('content_lb', {
    title: {
      type: DataTypes.STRING, // 类型是字符串
      // DEFAULT: 'default_title',
      // allowNull: false, // 不能为空
    },
    shop: DataTypes.STRING, // 类型是字符串
    photo: DataTypes.BLOB, // BLOB为图片约束类型
    state: DataTypes.INTEGER, //数据状态为整数类型
    sort: DataTypes.INTEGER, // 数据状态为数据排序
  }, {
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });
  // eslint-disable-next-line no-unused-vars
  contentLb.associate = function (models) {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return contentLb;
};
